log using isq-pta-labor-mainfigures,replace
version 13.1

//figure 1
use isq-pta-labor-law-data, replace

lpoly pta_n_net cbr_labor, lc(red) mc(gs11)ciop(clc(red))ci legend(off) note("") xsize(6.4) ysize(4.5) ///
graphregion(fcolor(white) ilcolor(white) lcolor(white) lp(blank) ilp(white)) msize(vsmall)mcol(gs12) lcol(6) ///
xtitle(Labor laws index, size(msmall)) ytitle(Cumulative number of PTAs, size(msmall))

 graph save labor_pta_figure-1a, replace

///
lpoly depth_rasch_mean cbr_labor, lc(red) mc(gs11)ciop(clc(red))ci legend(off) note("") xsize(6)  ///
graphregion(fcolor(white) ilcolor(white) lcolor(white) lp(blank) ilp(white)) msize(vsmall) mcol(gs12) lcol(6) ///
xtitle(Labor laws index, size(msmall)) ytitle(PTA depth,size(msmall))
 
 graph save labor_pta_figure-1b, replace

///
lpoly enforce01_mean cbr_labor, lc(red) mc(gs11)ciop(clc(red))ci legend(off) note("") xsize(6)  ///
graphregion(fcolor(white) ilcolor(white) lcolor(white) lp(blank) ilp(white)) msize(vsmall) mcol(gs12) lcol(6) ///
xtitle(Labor laws index,size(msmall)) ytitle(PTA enforcement,size(msmall))

 graph save labor_pta_figure-1c, replace 

graph combine labor_pta_figure-1b.gph  labor_pta_figure-1c.gph

graph save labor_pta_figure1bc, replace  

graph combine labor_pta_figure-1a.gph  labor_pta_figure1bc.gph, row(2)  xsize(6) ysize(8)

  graph export labor_pta_figure-1.pdf, replace 

//figure 2
use isq-pta-labor-law-data, replace

sort ccode1 year

quietly ivpoisson gmm pta_n_net lpwt_gc  lp_polity2 lleft lstatecp lwdi_fdiin lwdi_trade lln_gdppc lwdi_gdpgr lmulti lgattwto ///
 (lcbr_labor =l2.mean_cbr_region), wmatrix(cluster ccode1) 
 
 margins, dydx(*) post

 estimates store pta_labor

coefplot pta_labor, ylabel(,labsize(msmall)) mlabel mlabposition(12) mlabgap(*2) mlabsize(small) xsize(6.5) grid(none) msym(solid) drop(_cons) xline(0, lp(shortdash)lcol(gs10)) /// 
legend(off) format(%9.2g) ci(95) ///
ciopts(recast(. rbar) barwidth(. 0.35) fcolor(. white) lwidth(. medium))

   graph export labor_pta_figure-2.pdf, replace

 //figure 3
 use isq-pta-labor-law-data, replace

 ///democracies
quietly ivpoisson gmm pta_n_net lpwt_gc lp_polity2 lleft lstatecp lwdi_fdiin lwdi_trade lln_gdppc lwdi_gdpgr lmulti lgattwto ///
 (lcbr_labor =l2.mean_cbr_region) if p_polity2>=8&p_polity2!=., wmatrix(cluster ccode1)  

 margins, dydx(*) post
 
 estimates store pta_labor

coefplot pta_labor, ylabel(,labsize(msmall)) mlabel mlabposition(12) mlabgap(*2) mlabsize(small) xsize(6)grid(none) msym(solid) drop(_cons) xline(0, lp(shortdash)lcol(gs10)) /// 
legend(off) format(%9.2g) ci(95) ///
ciopts(recast(. rbar) barwidth(. 0.35) fcolor(. white) lwidth(. medium)) title(Democracies)

graph save labor_pta_f3a, replace
 
///non-democracies

quietly ivpoisson gmm pta_n_net lpwt_gc lp_polity2 lleft lstatecp lwdi_fdiin lwdi_trade lln_gdppc lwdi_gdpgr lmulti lgattwto ///
 (lcbr_labor =l2.mean_cbr_region) if p_polity2<8&p_polity2!=., wmatrix(cluster ccode1) 

 margins, dydx(*) post
 
 estimates store pta_labor

coefplot pta_labor, ylabel(,labsize(msmall)) mlabel mlabposition(12) mlabgap(*2)  mlabsize(small) xsize(6)grid(none) msym(solid) drop(_cons) xline(0, lp(shortdash)lcol(gs10)) /// 
legend(off) format(%9.2g) ci(95) ///
ciopts(recast(. rbar) barwidth(. 0.35) fcolor(. white) lwidth(. medium)) title(Non-democracies)

graph save labor_pta_f3b, replace

graph combine labor_pta_f3a.gph labor_pta_f3b.gph, xsize(6.5)

   graph export labor_pta_figure-3.pdf, replace
log off
log close
 